Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@turf/isolines
Advanced tools
@turf/isolines is a module within the Turf.js library that allows you to generate isolines (contour lines) from a grid of points with z-values. This is useful for visualizing elevation, temperature, or other continuous data over a geographic area.
Generate Isolines
This feature allows you to generate isolines from a grid of points with z-values. The code sample demonstrates creating a grid of points, assigning random z-values, and generating isolines based on specified breaks.
const turf = require('@turf/turf');
// Create a grid of points with z-values
const points = turf.pointGrid([-95, 30, -85, 40], 100, { units: 'miles' });
points.features.forEach((point, i) => {
point.properties.z = Math.random() * 10;
});
// Generate isolines
const breaks = [0, 2, 4, 6, 8, 10];
const isolines = turf.isolines(points, breaks, { zProperty: 'z' });
console.log(JSON.stringify(isolines));
d3-contour is a module in the D3.js library that provides tools for generating contour plots. It is similar to @turf/isolines in that it can generate contour lines from a set of data points. However, d3-contour is more focused on data visualization and is part of the broader D3.js ecosystem, which is widely used for creating complex and interactive visualizations.
marching-squares is a JavaScript library for generating contour lines using the Marching Squares algorithm. It is similar to @turf/isolines in that it can generate contour lines from a grid of data points. However, marching-squares is a more specialized library focused solely on the contour generation algorithm, whereas @turf/isolines is part of the larger Turf.js library for geospatial analysis.
Takes points with z-values and an array of value breaks and generates isolines.
Parameters
points
FeatureCollection<Point> input pointsz
string the property name in points
from which z-values will be pulledresolution
number resolution of the underlying gridbreaks
Array<number> where to draw contoursExamples
// create random points with random
// z-values in their properties
var points = turf.random('point', 100, {
bbox: [0, 30, 20, 50]
});
for (var i = 0; i < points.features.length; i++) {
points.features[i].properties.z = Math.random() * 10;
}
var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var isolined = turf.isolines(points, 'z', 15, breaks);
//=isolined
Returns FeatureCollection<LineString> isolines
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
$ npm install @turf/isolines
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
FAQs
turf isolines module
The npm package @turf/isolines receives a total of 576,081 weekly downloads. As such, @turf/isolines popularity was classified as popular.
We found that @turf/isolines demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.